﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;

namespace jnagr.Web
{
    public class shoppage:System.Web.UI.Page
    {
        public shoppage()
            : base()
        {

        }
        protected override void OnPreLoad(EventArgs e)
        {

            base.OnPreLoad(e);
            if (Session["user"] == null)
            {
                //login();
            }
        }
        public int getID()
        { 
            int id=0;
            if (Session["user"] != null)
            {
                DataTable dt=Session["user"] as DataTable;
                if(dt!=null)
                {
                    id = int.Parse(dt.Rows[0]["uid"].ToString());
                }                
            }
            return id;
        }
        public string  getPCC()
        { 
            string pcc="A,A,A";
            if (Session["user"] != null)
            {
                DataTable dt=Session["user"] as DataTable;
                if(dt!=null)
                {
                    pcc = dt.Rows[0]["uprovince"].ToString() + "," + dt.Rows[0]["ucity"].ToString() + ","+dt.Rows[0]["ucounty"].ToString();
                }                
            }
            return pcc;
        }
        public string getP()
        {
            string p = "";
            if (Session["user"] != null)
            {
                DataTable dt = Session["user"] as DataTable;
                if (dt != null)
                {
                    p= dt.Rows[0]["uprovince"].ToString();
                }
            }
            return p;
        }
        public int getLevel()
        { 
            int id=0;
            if (Session["user"] != null)
            {
                DataTable dt=Session["user"] as DataTable;
                if(dt!=null)
                {
                    id = int.Parse(dt.Rows[0]["ulevel"].ToString());
                }                
            }
            return id;
        }

        public void login()
        {
            Response.Redirect("~/jumpshop.html");
        }

    }
}